package com.invengo.module_check.ui.fragment.guide_listing.item;

import com.invengo.library_db.entity.module_check.BookBean;
import com.invengo.module_check.ui.fragment.guide_listing.ListingGuideViewModel;

import androidx.annotation.NonNull;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;

public class ListingGuideItmeViewModel extends ItemViewModel<ListingGuideViewModel> {

    public SingleLiveEvent<BookBean> book =new SingleLiveEvent<>();
    public ListingGuideItmeViewModel(@NonNull ListingGuideViewModel viewModel, BookBean bean) {
        super(viewModel);
        this.book.postValue(bean);
    }

    public BindingCommand removeItem = new BindingCommand(() -> {
        viewModel.onItemRemove(this);
    });
    public int getPosition() {
        return viewModel.getPosition(this) + 1;
    }

}
